<?php
require_once("Tpl/header.html");
?>
        <div id="main">
            <div class="header">
                <h1>Problem</h1>
            </div>
            <div class="content">
                <div class="table-responsive">
                    <table class="pure-table">
                        <thead>
                            <tr>
                                <th>课程</th>
                                <th><?php echo $detail["SubName"] ?></th>
                                <th>结束时间</th>
                                <th><?php echo $detail["problem.ProDate+problem.ProLength"] ?></th>
                                <?php if ($UserLevel == 2) echo "<!--" ?>
                                <th>最后提交</th>
                                <th><?php
                                    if (isset($problem["max(answer.AnsTime)"]))
                                        echo $problem["max(answer.AnsTime)"];
                                    else
                                        echo "no submit yet";
                                ?></th>
                                 <?php if ($UserLevel == 2) echo "-->" ?>
                                 <?php if ($UserLevel == 1) echo "<!--" ?>
                                <th>提交人数</th>
                                <th><?php
                                    if (isset($problem["count(answer.UserId)"]))
                                        echo $problem["count(answer.UserId)"];
                                    else
                                        echo "no submit yet";
                                ?></th>
                                 <?php if ($UserLevel == 1) echo "-->" ?>
                            </tr>
                        </thead>
                    </table>
                    <table class="pure-table">
                        <thead>
                            <tr>
                                <td>
                                    <?php echo $detail["problem.ProDetail"] ?>
                                </td>
                            </tr>
                            <tr class="center">
                                <?php if ($UserLevel == 1) echo "<!--" ?>
                                <td>
                                <form action="/index.php/Problem/delproblem">
                                    <input name="pid" id="pid" value="<?php echo $pid ?>" type="hidden">
                                    <button type="submit" class="pure-button pure-button-primary">Delete</button>
                                </form>
                                </td>
                                <?php if ($UserLevel == 1) echo "-->" ?>
                                <?php if ($UserLevel == 1) echo "<!--" ?>
                                <td>
                                <form action="/index.php/Source/index">
                                    <input name="pid" id="pid" value="{$pid}" type="hidden">
                                    <button type="submit" class="pure-button pure-button-primary">Download</button>
                                </form>
                                </td>
                                <?php if ($UserLevel == 1) echo "-->" ?>
                                <?php if ($UserLevel == 2) echo "<!--" ?>
                                <td>
                                <form id="upload" method='post' action="/index.php/problem/answer" enctype="multipart/form-data">
                                    <input name="pid" type="hidden" value="<?php echo $pid ?>">
                                    <input name="uid" type="hidden" value="<?php echo $UserId ?>">
                                    <input name="homework" type="file" />
                                    <button type="submit" class="pure-button pure-button-primary">Upload</button>
                                </form>
                                </td>
                                <?php if ($UserLevel == 2) echo "-->" ?>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
